home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
241_01
/
inferenc.doc
< prev
next >
Wrap
Text File
|
1987-08-29
|
46KB
|
1,189 lines
INFERENCE -- SOFTMAN ENTERPRIZES -- Dec. 30, 1985
INTRODUCTION:
The software contained in this distribution is copyright (C) by
George Hageman 1985 and is released into the public
domain with the following restrictions:
(1) This software is intended for non-commertial usage.
(2) I am held save from damages resulting from
its use, and
(3) The following concepts and legal jargon are agreed to
by the user of this software.
User-supported software concept:
IF you find use for this software
ANDIF it saves you some development time
THEN send me $10.00
ANDTHENHYP you will feel good!
This source code is provided on an "as is" basis without warranty
of any kind, expressed or implied, including but not limited to
the implied warranties of merchantability and fitness for a
particular purpose. The entire risk as to quality and
performance of this software is with you. Should the software
prove defective, you assume the entire cost of all necessary
repair, servicing, or correction. In no event will the author be
liable to you for any damages, including any lost profits, lost
savings, or other incidental or consequential damages arising out
of the use of inability to use this software. In short my
friends, I have done a reasonable amount of work in debugging
this software and I think it is pretty good but, as you know,
there is always some chance that a bug is still lurking around.
If you should happen to be lucky enough to find one, please let
me know so I can make an attempt to fix it.
The following is a short description of how to use the
inference engine and rule-compiler contained in this software
release. The source and object files for the rule compiler and
the inference engine are contained in the files named *.?R and
*.?I, respectively. There are common files in each library.
These common files are header files which are used to define
common terms between the different sources. The most important
header file is the file named "expert.h" which not only contains
common definitions used between the rule compiler and the
inference engine, but has a short description of their usage as
well. This inference engine, and its associated rule compiler,
represents a significant time investment for me, so if you
believe in the shareware concept please remember my address.
George W. Hageman
P.O. Box 11234
Boulder, Colorado 80301
George W. Hageman --1--
INFERENCE -- SOFTMAN ENTERPRIZES -- Dec. 30, 1985
This software compiles using the Microsoft C Compiler Rev
3.0 using the make function which comes with the Microsoft Macro
Assembler Rev. 4.0. I have nothing but good things to say about
these two products and suggest that you consider their purchase
if you are into serious software development for the PC. This
software also compiles and runs under UNIX system V. Use the
UNIXSV flag in the makefile or use a -DUNIXSV when you compile
it.
George W. Hageman --2--
INFERENCE -- SOFTMAN ENTERPRIZES -- Dec. 30, 1985
INFERENCE ENGINES:
An inference engine is merely a program which attempts to
prove consequents given a certain set of antecedents and a set of
rules which define the TRUTH or FALSEness of each consequent in
terms of the antecedents. The consequents, antecedents and
rules for this inference engine are contained in a text file
which is compiled by the rule-compiler into a form the inference
engine can understand. Often these two functions are contained
in the same executeable, but I have decided to split them up to
make the inference engine as small as possible.
Rules are collections of ANTECEDENTS and CONSEQUENTS formed
into TRUTH statements. Each rule is an attempt state that "If
all of the antecedents for this particular RULE are TRUE, then
all of the consequents connected to this rule are TRUE. If one
or more of the antecedents for a RULE are FALSE, then it is
assumed that this rule cannot prove the TRUTH of the consequents,
but this does not necessarily prove the consequents FALSE since
some other rule may prove them TRUE." Rules must have at least
one ANTECEDENT and at least one CONSEQUENT to be considered
valid.
Each ANTECEDENT and CONSEQUENT is a simple statement
consisting of a leading KEYWORD, and a FOLLOWING STRING.
KEYWORDS tell the inference engine what the FOLLOWING STRING will
mean or what is to be done with it. The FOLLOWING STRINGs may be
either in upper or lower case and are either statements such as
"THE ANIMAL IS A BAT", or, a pathname to an executeable which
will be loaded and executed depending on what is defined by the
KEYWORD. Strings, except for the number of leading blanks, can be
considered equal only if they are identical. The reason for this
rule will become apparent later. An example of a pathname
FOLLOWING STRING is "/b1/hageman/expert/storm/gt_3200 data.fil".
Note that the strings denoting pathnames should be exactly as
they would be if the pathname were to be given at a terminal,
also, you may include parameters with any pathname. These
parameters are no different than the parameters that you would
use if you were initiating the executeable from the terminal
rather than via the inference engine. Under MS_DOS these path
names can either be upper or lower case, and for the UNIX
operating system, they must correspond to the exact path name.
George W. Hageman --3--
INFERENCE -- SOFTMAN ENTERPRIZES -- Dec. 30, 1985
QUICK AND DIRTY:
Impatient? Well here are some quick ways to get started
with the inference engine, leave all that reading till later!
ONE:
Use your text editor (WS in the Non-document mode only
Please) to create a quick rule file, or use the animals example
contained in this release. Skip to the next page if you want to
find out what the KEYWORDS are and how to use them.
TWO:
Compile the rules with the rule-compiler by typing..
rulecomp inputfile outputfile
where the inputfile is the filename of the file containing
your rules, and the outputfile is the file inwhich you want the
compiled rules to be written to. Caution, the rule compiler does
not check for the equivalence of the inputfile and outputfile
filenames, if they are identical you will probably have to type
in your r